#define _CRT_SECURE_NO_WARNINGS 1


#include<stdlib.h>
#include<stdio.h>
#include<string.h>

char* sortSentence(char* s)
{
    int size = strlen(s);
    char* str[200] = { 0 };
    str[0] = strtok(s, " ");
    int i = 0;
    while (str[i])
    {
        str[++i] = strtok(NULL, " ");
    }
    int arr[10] = { 0 };
    for (int j = 0; j < i; j++)
    {
        int len = strlen(str[j]);
        arr[str[j][len - 1] - '0'] = j + 1;
        str[j][len - 1] = ' ';
    }
    char* ret = (char*)malloc(sizeof(char) * size);
    int index = 0;
    for (int j = 0; j < 10; j++)
    {
        if (arr[j] != 0)
        {
            int len = strlen(str[arr[j] - 1]);
            for (int k = 0; k < len; k++)
            {
                ret[index++] = str[arr[j] - 1][k];
            }
        }
    }
    ret[index - 1] = '\0';
    return ret;
}